<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
	<head>
		<meta charset="utf-8">
		<title>考勤管理</title>
		<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css" />
		<link rel="stylesheet" type="text/css" href="../../static/css/me.css" th:href="@{/css/me.css}"/>
	</head>
	<body>
		<!-- 头部 -->
		<nav class="ui padded-t-small">
			<div class="ui container">
				<div class="ui secondary menu">
					<h2 class="ui blue header item">辅导员管理系统</h2>
					<div class="right menu m-item m-mobile-hide">
						<div class="ui dropdown item">
							<div class="text">
								<i class="user blue big icon"></i>
								<span th:text="${session.user.nickname}">王锦超</span>
							</div>
							<i class="dropdown icon"></i>
							<div class="menu">
								<a href="#" th:href="@{/logout}" class="item">退出</a>
							</div>
						</div>
					</div>

				</div>
				<div class="ui secondary pointing three item demo menu">
					<a href="notice.html" th:href="@{/admin/notice}" class="item">公告管理</a>
					<a href="record.html" th:href="@{/admin/record}" class="active item">考勤管理</a>
					<a href="infor.html" th:href="@{/admin/infor}" class="item">学生信息</a>
				</div>
			</div>
		</nav>
		<!-- 主体 -->
		<div class="ui container margin-t-small">
			<div class="ui segment">
				<div class="ui selection dropdown">
					<input type="hidden" name="type"/>
					<i class="dropdown icon"></i>
					<div class="default text">是否同意</div>
					<div class="menu">
						<div class="item" onclick="search(this)" data-value="false">
							未同意
						</div>
						<div class="item" onclick="search(this)" data-value="true">
							同意
						</div>
					</div>
				</div>
			</div>

			<table th:fragment="rs" class="ui celled table rs">
				<thead>
					<tr>
						<th>日期</th>
						<th>姓名</th>
						<th>学号</th>
						<th>班级</th>
						<th>状态</th>
						<th>备注</th>
						<th>是否同意</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<tr th:each="rec:${re}">
						<td th:text="${rec.recordTime}">2020-03-03</td>
						<td th:text="${rec.name}">王锦超</td>
						<td th:text="${rec.sno}">170319170222</td>
						<td th:text="${rec.grades}">计算1702</td>
						<td th:text="${rec.state}">迟到</td>
						<td th:text="${rec.remarks}"></td>
						<td th:text="${rec.opinion}?'是':'否'">否</td>
						<td>
							<a href="#" th:href="@{/record/{id}/update(id=${rec.id})}" class="ui mini basic blue button">同意</a>
							<a href="#" th:href="@{/record/{id}/delete(id=${rec.id})}" class="ui mini basic red button">删除</a>
						</td>
					</tr>
				</tbody>
				<tfoot>
					<tr>
						<th colspan="8">
							<a th:href="@{/record/input}" class="ui mini right floated basic blue button">新增</a>
						</th>
					</tr>
				</tfoot>
			</table>

		</div>



		<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
		<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
		<script>
			$('.ui.dropdown').dropdown();

			function search(obj) {
				var url = '/notice/search';
				console.log($(obj).data("value"));
				$.ajax({
					url: url,
					type: 'POST',
					data:{opinion:$(obj).data("value")},
					success: function (data) {
						$(".ui.rs").html(data);
					}
				})
			}
		</script>
	</body>
</html>
